/**
 *
 */
package cc.aileron.commons.util.function;

import java.util.Collection;
import java.util.List;

/**
 * @author aileron
 * @param <P>
 */
public abstract class Fillter<P> implements FillterFunction<P>,
        CollectionFunction<P, List<P>>
{
    @Override
    public List<P> get(final List<P> list)
    {
        return CollectionFunctions.fillter(list).apply(this);
    }

    @Override
    public final List<P> get()
    {
        if (list == null)
        {
            throw new UnsupportedOperationException();
        }
        return CollectionFunctions.fillter(list).apply(this);
    }

    /**
     * defualt constractor
     */
    public Fillter()
    {
        list = null;
    }

    /**
     * @param list
     */
    public Fillter(final Collection<P> list)
    {
        this.list = list;
    }

    private final Collection<P> list;
}
